package juc.thread;
/*
* 测试interrupt
* */
public class Test1 {
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            while (true){
              if(Thread.interrupted()){
                  System.out.println("终止线程...");
                  break;
              }
            }
        }, "t1");
        t1.start();
        Thread.sleep(10);
        t1.interrupt();
    }
}
